import Vue from 'vue';
import loadingComponent from './loading';
const lConstructor = Vue.extend(loadingComponent);
const lInstance = new lConstructor({el: document.createElement('div')});
lInstance.show = false;
const loading = {
    show: () => {
        if(lInstance.show == false) {
            lInstance.show = true;
        }
        if(!document.querySelector('.one-loading')) {
            document.body.appendChild(lInstance.$el);
        }
    },
    hide: () => {
        if(lInstance.show == true) {
            lInstance.show = false;
        }
    }
}
export default {
    install: () => {
        Vue.prototype.$loading = loading;
    }
}